package cn.com.tarotframework.config.api;


import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.License;
import lombok.Data;
import org.springdoc.core.SpringDocConfigProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Lazy;

import java.util.List;

import static org.springdoc.core.Constants.SPRINGDOC_ENABLED;


/**
 * copyright (C), 2022, 塔罗牌基础架构
 *
 * @program tarot-openapi-spring-boot-starter
 * @description OpenApi配置类
 * @author Jiang Xincan
 * @version 0.0.1
 * @create 2022/5/20 18:54
 **/
@Lazy(false)
@Data
@ConfigurationProperties(prefix = "tarot.openapi")
@ConditionalOnProperty(name = SPRINGDOC_ENABLED, matchIfMissing = true)
public class TarotOpenApiProperties {

    // 应用名称
    private String applicationName;

    // 应用说明
    private String description;

    // 应用版本
    private String version;

    // 应用内部api分组
    private Group group;

    // 应用描述说明
    private Contact contact;

    // 应用license信息
    private License license;

    // 应用文档信息
    private ExternalDocumentation externalDocs;

    /**
     * 分组对象
     * @author xincan
     * @date 2023/1/12 16:51
     */
    @Data
    public static class Group {

        // 是否开启api分组
        private String enabled;

        // api分组集合
        private List<SpringDocConfigProperties.GroupConfig> groupConfigs;

    }

}
